//
//  PersonalCenterViewController.m
//  LiverClient
//
//  Created by dongshangtong on 16/5/3.
//  Copyright © 2016年 朱亚杰. All rights reserved.
//

#import "PersonalCenterViewController.h"
#import "PersonalViewCell.h"
#import "MenberModel.h"

@interface PersonalCenterViewController ()<UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate, UINavigationControllerDelegate>


@property (nonatomic ,strong)UITableView *tableView;


@end

@implementation PersonalCenterViewController

- (UITableView *)tableView {
    if (!_tableView) {
        self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
        self.tableView.separatorStyle  = UITableViewCellSeparatorStyleNone;
        
        self.tableView.dataSource= self;
        self.tableView.delegate = self;
        [self.view addSubview:self.tableView];
        
    }
    
    return _tableView;
    
}


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.barTintColor =BackgroundColor;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title =@"个人中心";
    self.view.backgroundColor = [UIColor brownColor];
   // [self getMembersInfo];
    [self.tableView registerNib:[UINib nibWithNibName:@"PersonalViewCell" bundle:nil] forCellReuseIdentifier:@"PersonalViewCell"];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modifMenderEdit:) name:@"modifMenderEdit" object:nil];
    
}


- (void)modifMenderEdit:(NSNotification *)notification {
  //  [self getMembersInfo];
}


/**
 *  获取会员信息
 */
//- (void)getMembersInfo {
//    
//    NSString *menber_Id = [YCUserManager sharedInstance].menberId;
//    
//    if (!menber_Id) return;
//    
//    NSString *url = [YCUrlManger sharedInstance].memberinfoUrl;
//    
//    NSDictionary *parems = @{
//                             @"member_id":menber_Id
//                             };
//    
//    [DownloadData post:url SerializerType:1 params:parems success:^(id json) {
//        self.menber = [MenberModel mj_objectWithKeyValues:json];
//        
//        [self.tableView reloadData];
//        
//    } failure:^(NSError *error) {
//        
//    }];
//    
//}

//MARK:~~~~ UITableViewDelegate,UITableViewDataSource ~~~~
- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    PersonalViewCell *cell = [PersonalViewCell personalViewCellWithTable:tableView];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.showArrow = YES;
    if (indexPath.row == 0) {
        cell.themeLabel.text = @"头像";
        [cell.iconImage sd_setImageWithURL:[NSURL URLWithString:self.menber.memberPic] placeholderImage:[UIImage imageNamed:@""]];
    } else if (indexPath.row == 1) {
        cell.themeLabel.text = @"姓名";
        cell.SubLable.text = self.menber.memberName;
    } else if(indexPath.row == 2) {
        cell.themeLabel.text = @"性别";
        cell.SubLable.text = self.menber.memberSex;
    } else if(indexPath.row == 3) {
        cell.themeLabel.text = @"手机号";
        cell.SubLable.text = self.menber.memberMobile;
    }
    return cell;
}

- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}









@end
